<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电影网站 - 注册</title>
    <style>
        body {
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background-color: #333;
            color: white;
            padding: 15px 0;
        }
        
        .nav {
            display: flex;
            justify-content: space-around;
            max-width: 1200px;
            margin: 0 auto;
        }
        
         .nav-item a 
        {
            color: white;
            text-decoration: none;
        }

        .nav-item a:visited,
        .nav-item a:hover,
        .nav-item a:active {
            color: white;
        }

        .nav-item a:hover {
            opacity: 0.8;
        }
        
        .auth-links {
            position: absolute;
            right: 20px;
            top: 15px;
        }
        
        .auth-links a {
            color: white;
            text-decoration: none;
            margin-left: 15px;
        }
        
        .container {
            max-width: 400px;
            margin: 50px auto;
            background-color: white;
            padding: 30px;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            position: relative;
        }
        
        h1 {
            text-align: center;
            margin-bottom: 30px;
            font-size: 24px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
        }
        
        input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        
        input::placeholder {
            color: #aaa;
        }
        
        .btn {
            width: 100%;
            padding: 12px;
            background-color: #ff5f5f;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }
        
        .btn:hover {
            background-color: #ff3f3f;
        }
        
        .login-link {
            text-align: center;
            margin-top: 20px;
        }
        
        .login-link a {
            color: #ff5f5f;
            text-decoration: none;
        }
        
        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
        }
        
        .modal-content {
            background-color: white;
            margin: 15% auto;
            padding: 30px;
            border-radius: 5px;
            width: 300px;
            text-align: center;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }
        
        .modal-title {
            font-size: 20px;
            margin-bottom: 20px;
        }
        
        .modal-btn {
            padding: 8px 20px;
            background-color: #ff5f5f;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }
        
        .modal-btn:hover {
            background-color: #ff3f3f;
        }
        
        /* 密码匹配提示 */
        .password-hint {
            color: #ff5f5f;
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="nav">
            <div class="nav-item"><a href="首页.html">首页</a></div>
            <div class="nav-item"><a href="首页.html">电影</a></div>
            <div class="nav-item"><a href="首页.html">电视剧</a></div>
            <div class="nav-item"><a href="首页.html">电影院</a></div>
            <div class="auth-links">
                <a href="登录.html" class="dl">登录</a>
                <a href="注册.html" class="zc">注册</a>
            </div>
        </div>
    </div>
    
    <div class="container">
        <h1>注册</h1>
        
        <form id="registerForm">
            <div class="form-group">
                <label for="username">账号</label>
                <input type="text" id="username" placeholder="请输入账号" required>
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" placeholder="请输入密码" required>
            </div>
            
            <div class="form-group">
                <label for="confirm-password">确认密码</label>
                <input type="password" id="confirm-password" placeholder="请再次输入密码" required>
                <div id="passwordHint" class="password-hint">两次输入的密码不一致</div>
            </div>
            
            <button type="submit" class="btn">注册</button>
        </form>
        
        <div class="login-link">
            已有账号，<a href="#"><a href="登录.html" class="dl">前往登录</a></a>
        </div>
    </div>
    
    <!-- 注册成功弹窗 -->
    <div id="successModal" class="modal">
        <div class="modal-content">
            <div class="modal-title">注册成功</div>
            <button class="modal-btn" onclick="closeModal()"><a href="登录2.html" class="dl">返回登录</a></button>
        </div>
    </div>
    
    <script>
        // 获取表单和弹窗元素
        const registerForm = document.getElementById('registerForm');
        const successModal = document.getElementById('successModal');
        const passwordInput = document.getElementById('password');
        const confirmPasswordInput = document.getElementById('confirm-password');
        const passwordHint = document.getElementById('passwordHint');
        
        // 表单提交事件
        registerForm.addEventListener('submit', function(e) {
            e.preventDefault(); // 阻止表单默认提交行为
            
            // 验证密码是否匹配
            if (passwordInput.value !== confirmPasswordInput.value) {
                passwordHint.style.display = 'block';
                return;
            } else {
                passwordHint.style.display = 'none';
            }
            
            // 这里可以添加实际的注册逻辑
            // 模拟注册成功
            showModal();
        });
        
        // 确认密码实时验证
        confirmPasswordInput.addEventListener('input', function() {
            if (passwordInput.value !== confirmPasswordInput.value) {
                passwordHint.style.display = 'block';
            } else {
                passwordHint.style.display = 'none';
            }
        });
        
        // 显示弹窗
        function showModal() {
            successModal.style.display = 'block';
        }
        
        // 关闭弹窗
        function closeModal() {
            successModal.style.display = 'none';
            
            // 这里可以添加注册成功后的跳转逻辑
            // window.location.href = 'login.html';
        }
        
        // 点击弹窗外部关闭弹窗
        window.onclick = function(event) {
            if (event.target == successModal) {
                closeModal();
            }
        }
    </script>
</body>
</html>